/**
 * [comicTypeByFather 将指定漫画的分类列表按父类分组输出]
 * @param  {[type]} classify [获取公共分类]
 * @param  {[type]} idList   [漫画分类id, 格式为: 1,2,3]
 * @return {[type]}          [description]
 */
export function comicTypeByFather(classify, idList) {
    const _this = this;

    let obj, ids;

    ids = _this.toStr(idList).trim().replaceStarEndChar(',', ''); //去除前后限定符
    if (!classify || ids.length === 0) {
        throw new Error('传入classify或idList不合法!');
    }
    const tmpAry = ids.split(',');

    obj = {};

    let fatherId;

    tmpAry.forEach(function (v) {
        const intV = isNaN(parseInt(v, 10)) ? 0 : parseInt(v, 10);

        if (!intV) {
            return false; // 去除无效id
        }
        fatherId = classify[1][intV].father;
        if (!Array.isArray(obj[fatherId])) {
            obj[fatherId] = [];

        }
        obj[fatherId].push({
            id: intV,
            name: classify[1][intV].name
        });
    });

    return obj;
}